package com.guaju.yueshangLife.viewmodel;

import android.databinding.BaseObservable;
import android.databinding.BindingAdapter;
import android.util.Log;
import android.view.View;
import android.widget.RadioGroup;

import com.guaju.yueshangLife.R;
import com.guaju.yueshangLife.databinding.FragmentCategoryBinding;

public class CategoryVM extends BaseObservable {
    private static final String TAG = "CategoryVM";

    public   RadioGroup.OnCheckedChangeListener onCheckedChangeListener;
    FragmentCategoryBinding binding;
    public CategoryVM(FragmentCategoryBinding binding){
        this.binding=binding;
        onCheckedChangeListener = new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId) {
                    case R.id.category_all:
                        Log.e(TAG, "onCheckedChanged: 全部分类" );
//                        showAll();
                        break;
//                    case R.id.category_brand:
//                        showBrand();
//                        break;
//                    case R.id.category_style:
//                        Log.e(TAG, "onCheckedChanged: 款式" );
//                        showStyle();
//                        break;
//                    case R.id.category_material:
//                        Log.e(TAG, "onCheckedChanged: 面料" );
//                        showMaterial();
//                        break;
//                    case R.id.category_member:
//                        Log.e(TAG, "onCheckedChanged: 会员" );
//                        showMember();
//                        break;
//                    case R.id.category_vip:
//                        Log.e(TAG, "onCheckedChanged: 高级会员" );
//                        showVip();
//                        break;
//                    case R.id.category_design:
//                        Log.e(TAG, "onCheckedChanged: 高端定制" );
//                        showDesign();
//                        break;
                }
            }
        };
    }

    @BindingAdapter("app:onRbchange")
    public static void onRbChangeListener(RadioGroup rg,RadioGroup.OnCheckedChangeListener onCheckedChangeListener){
        rg.setOnCheckedChangeListener(onCheckedChangeListener);
    }


//    public void showBrand(){
//        hideAll();
//        binding.cateContentBrand.setVisibility(View.VISIBLE);
//
//    }
//    public void showStyle(){
//        hideAll();
//        binding.cateContentStyle.setVisibility(View.VISIBLE);
//
//    }
//    public void showMaterial(){
//        hideAll();
//        binding.cateContentMaterial.setVisibility(View.VISIBLE);
//    }
//    public void showMember(){
//        hideAll();
//        binding.cateContentBrand.setVisibility(View.VISIBLE);
//        binding.cateContentStyle.setVisibility(View.VISIBLE);
//        binding.cateContentMaterial.setVisibility(View.VISIBLE);
//    }
//    public void showVip(){
//        showMember();
//    }
//    public void showDesign(){
//        hideAll();
//        binding.cateContentDesign.setVisibility(View.VISIBLE);
//    }
//
//    public void hideAll(){
//        binding.cateContentBrand.setVisibility(View.GONE);
//        binding.cateContentDesign.setVisibility(View.GONE);
//        binding.cateContentMaterial.setVisibility(View.GONE);
//        binding.cateContentStyle.setVisibility(View.GONE);
//    }
//
//    public void showAll(){
//        binding.cateContentBrand.setVisibility(View.VISIBLE);
//        binding.cateContentDesign.setVisibility(View.VISIBLE);
//        binding.cateContentMaterial.setVisibility(View.VISIBLE);
//        binding.cateContentStyle.setVisibility(View.VISIBLE);
//    }
}
